package com.lsh.oms.core.dao.query;

import com.lsh.oms.core.dao.MyBatisRepository;
import com.lsh.oms.core.model.order.OrderHead;
import com.lsh.oms.core.model.query.MisOrderAftersales;
import com.lsh.oms.core.model.query.MisOrderDetailExtForDetail;
import com.lsh.oms.core.model.query.MisOrderDetailForDetail;
import com.lsh.oms.core.model.query.MisOrderHeadExtForDetail;
import com.lsh.oms.core.model.query.MisOrderHeadForDetail;
import com.lsh.oms.core.model.query.MisOrderHeadForList;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 *
 * @author panxudong
 * @date 16/8/20
 */
@MyBatisRepository
public interface FindOrderByMisDao {

    List<MisOrderHeadForList> getOrderHeadList(List<Long> orderCodeList);

    Integer getEffectiveOrderCount(@Param("userCode") Long userCode, @Param("userCancelOrderStatus") Integer userCancelOrderStatus,
                                   @Param("customServiceCancelOrderStatus") Integer customServiceCancelOrderStatus,
                                   @Param("systemCancelOrderStatus") Integer systemCancelOrderStatus);

    MisOrderHeadForDetail getOrderHead(Long orderCode);

    MisOrderHeadExtForDetail getOrderHeadExt(Long orderId);

    List<MisOrderDetailForDetail> getOrderDetailList(Long orderCode);

    List<MisOrderDetailExtForDetail> getOrderDetailExtList(List<Long> orderDetailIdList);

    List<OrderHead> getOrderHeadListByAddressCodeAndUserCode(@Param("addressCode") Long addressCode,
                                                             @Param("userCode") Long userCode,
                                                             @Param("startStatus") Integer startStatus,
                                                             @Param("endStatus") Integer endStatus);


    List<OrderHead> getOrderHeadListByTimes(@Param("startTime") Integer startTime,
                                            @Param("endTime") Integer endTime,
                                            @Param("regionCode") Integer regionCode,
                                            @Param("orderStatus") Integer orderStatus);

    Integer getOrderHeadCountByAddressCode(@Param("addressCode") Long addressCode,
                                           @Param("notEditStatus") Integer notEditStatus,
                                           @Param("cancelCostumerStatus") Integer cancelCostumerStatus,
                                           @Param("cancelCostumerServiceStatus") Integer cancelCostumerServiceStatus,
                                           @Param("startTime") Integer startTime);

    Map<String, Object> getOrderHeadCountAndTimeByAddressCode(@Param("addressCode") Long addressCode,
                                                              @Param("cancelCostumerStatus") Integer cancelCostumerStatus,
                                                              @Param("cancelCostumerServiceStatus") Integer cancelCostumerServiceStatus,
                                                              @Param("cancelSystemStatus") Integer cancelSystemStatus);

    MisOrderAftersales getOrderAftersalesInfo(@Param("orderCode") Long orderCode);

    MisOrderHeadForList getOrderForAfterSales(@Param("addressCode") Long addressCode,
                                              @Param("sortingStatus") Integer sortingStatus);


    List<Map<String, Object>> getReturnOrderList(List<Long> codes);

    List<Map<String, Object>> getDeliveryOrderList(List<Long> codes);

    List<Map<String, Object>> getReceiptOrderList(List<Long> codes);

    Map<String, Object> getReturnOrder(Long code);

    Map<String, Object> getDeliveryOrder(Long code);

    Map<String, Object> getReceiptOrder(Long code);

    List<Map<String, Object>> getReturnOrderDetail(Long code);

    List<Map<String, Object>> getDeliveryOrderDetail(Long code);

    List<Map<String, Object>> getReceiptOrderDetail(Long code);

    List<Map<String, Object>> getReceiptInfoByOrderIds(List<Long> codes);

    List<Map<String, Object>> getDeliveryInfoByOrderIds(List<Long> codes);

    List<Map<String, Object>> getDeliveryOrderDetails(List<Long> codes);

    List<Map<String, Object>> getReceiptOrderDetails(List<Long> codes);

    Map<String, Object> getReturnByDeliveryId(Long code);

    Map<String, Object> getReceiptByDeliveryId(Long code);

    List<Map<String, Object>> getDeliveryDetails(List<Long> codes);

    List<Map<String, Object>> getReceiptInfoByDeliveryIds(List<Long> codes);

    Map<String, Object> getReturnByOrderId(Long code);

    Map<String, Object> getReceiptByOrderId(Long code);

    Map<String, Object> getDeliveryByOrderId(Long code);

    List<Map<String, Object>> getReturnInfoByOrderIds(List<Long> codes);

    List<Map<String, Object>> getReturnInfoByShippingIds(List<Long> codes);

    List<Map<String, Object>> getReturnOrderDetails(List<Long> codes);

    List<Map<String, Object>> getReturnOrdersByFOrderIdOrReturnOrderId(@Param("fOrderId") Long fOrderId,
                                                                       @Param("isMp") Integer isMp,
                                                                       @Param("type") Integer type,
                                                                       @Param("code") Long code);

    List<Map<String, Object>> getReceiptDetails(@Param("code") Long code, @Param("query") String query);

    Map<String, Object> getReceiptDetailInfo(@Param("code") Long code, @Param("detailCode") Long detailCode);

    Integer getOrderHeadCountByUserCode(@Param("userCode") Long userCode,
                                        @Param("notEditStatus") Integer notEditStatus,
                                        @Param("finishStatus") Integer finishStatus);

    Map<String, Object> getAfterSaleReturnByOrderId(Long code);

    List<Long> getOrderCodesByTimeRange(@Param("startTime") Integer startTime, @Param("endTime") Integer endTime);

    List<Long> getNotPayOrderCodesByUid(Long uid);
}
